package com.EM1.www.dao;

import com.EM1.www.util.Connectmysql;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

public class ConnectIdentity {
    public int Selectidentify(String identify) throws Exception {
        Connection conn = Connectmysql.Connectmysql();
        String sql="select * from identify where identify=?";
        PreparedStatement pmt = conn.prepareStatement(sql);
        pmt.setString(1,identify);
        ResultSet res = pmt.executeQuery();
        while (res.next()){
            return res.getInt("id");
        }
        return -1;
    }
    public void Deleteidentify(int id) throws Exception {
        Connection conn = Connectmysql.Connectmysql();
        String sql="delete from identify where id=?";
        PreparedStatement pmt = conn.prepareStatement(sql);
        pmt.setInt(1,id);
        pmt.executeUpdate();
    }
}
